package correct.day20;

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long h = in.nextLong();
        long b = in.nextLong();
        long k = in.nextLong();
        long red = 0;

        long num = Math.min(k / a, h / b) + 1;
        red += num * (a + b);
        k -= num * a;
        h -= num * b;
        if(k > 0 && h <= 0) {
            red += 10 * b;
        }
        if(h > 0 && k <= 0) {
            red += 10 * a;
        }

        System.out.println(red);
    }
}
